//
//  BGUserInforButton.swift
//  Baga
//
//  Created by 飞王 on 16/12/30.
//  Copyright © 2016年 飞王. All rights reserved.
//

import UIKit

class BGUserInforTextField: UITextField {

    init(placeholderText:String?,leftImageName:String?) {
//        super.init(type: .custom);
        super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0));
        if (leftImageName != nil) {
            let leftImage = UIImage(named: leftImageName!);
            leftView = UIImageView(image: leftImage);
            leftViewMode = UITextFieldViewMode.always;
        }
        
        if (placeholderText != nil) {
            placeholder = placeholderText;
        }
        
        setupViews();
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupViews() {
        addSubview(bottomLine);
        
        bottomLine.snp.makeConstraints { (make) in
            make.left.equalTo(self);
            make.right.equalTo(self);
            make.height.equalTo(1);
            make.bottom.equalTo(self).offset(-10);
        }
        
    }
    
    private lazy var bottomLine: UIView = {
        let bottomLine = UIView();
        bottomLine.backgroundColor = UIColor.lightGray;
        return bottomLine;
    }()
    
    

}
